﻿#pragma once
#include <QGraphicsView>

#include "SeriesBase.h"

class QGraphicsScene;
class QGraphicsPixmapItem;
class QGraphicsWidget;
class DicomView : public QGraphicsView
{
	Q_OBJECT

public:


	DicomView(QWidget* parent = 0);
	~DicomView();

	void setSeries(SeriesBase* series);
	void resizePixmapItem(); // 窗口改变时
	void repositionAuxItems(); // 窗口改变时
	void updateView();
	void setHighlight(bool yes);

public slots:
	void setCurFrameItem(int);

signals:
	void windowChanged();// 窗宽位改变信号
	void clicked(SeriesBase::ViewType);

protected:
	void mousePressEvent(QMouseEvent* event);
	void mouseMoveEvent(QMouseEvent* event);
	void mouseReleaseEvent(QMouseEvent* event);
	void wheelEvent(QWheelEvent* e);
	void resizeEvent(QResizeEvent* event);
	QSize sizeHint() const { return hintSize; }

private:
	QGraphicsScene* scene;// 场景
	QGraphicsPixmapItem* pixmapItem;// 场景中的图像


	SeriesBase* dicoms;
	QSize hintSize;
	double factor;
	double fixFactor;// xspace/yspace
	QPoint prevMousePos;

};
